package com.itheima.reggie.common;

/**
 * @version 1.0
 * @Author 杨旭康
 * @Date 2022/10/26 23:12
 * @question:   基于ThreadLocal提供的工具类,来获取和保存当前登录的用户id
 */

public class BaseContext {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    public static Long getCurrentId() {
        return threadLocal.get();
    }

}
